home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6879 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.misc,comp.lang.perl.misc,comp.lang.tcl,comp.lang.c,comp.lang.java
  4. Subject: Re: Readable Perl (was: Re: Relative Speed of Perl vs. Tcl vs. C)
  5. Date: 15 Feb 1996 14:58:53 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4g0drdINN167@keats.ugrad.cs.ubc.ca>
  8. References: <4e3a2u$eoa@wcap.centerline.com> <4fncgf$96e@solutions.solon.com> <JTV2J.96Feb12142743@mamba.cs.virginia.edu> <ukd97hwzkc.fsf_-_@linda.teleport.com>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <ukd97hwzkc.fsf_-_@linda.teleport.com>,
  12. Randal L. Schwartz <merlyn@stonehenge.com> wrote:
  13. >>>>>> "John" == John Viega <jtv2j@mamba.cs.virginia.edu> writes:
  14. >
  15. >John> People bitch about the readability of Perl non-stop.  In fact, I have
  16. >John> heard the joke, "Perl, the only language you can uuencode, and not
  17. >John> notice" twice this week around the department.
  18. >
  19. >OK, now which do you find most readable...
  20. >
  21. >    $i = 1;
  22. >    while ($i <= 10) {
  23. >        print "I can count to $i\n";
  24. >        $i++;
  25. >    }
  26. >
  27. >    for ($i = 1; $i <= 10; $i++) {
  28. >        print "I can count to $i\n";
  29. >    }
  30. >
  31. >    foreach $i (1..10) {
  32. >        print "I can count to $i\n";
  33. >    }
  34. >
  35. >    $i = 0;
  36. >    print "I can count to $i\n" while ++$i <= 10;
  37. >
  38. >    print map "I can count to $_\n", 1..10;
  39. >
  40. >    50 FOR I = 1 TO 10
  41. >    60 PRINT "I CAN COUNT TO ",I
  42. >    70 NEXT I
  43.  
  44. None of the above, bud.
  45.  
  46. I find this readable
  47.  
  48.     for x in 1 2 3 4 5 6 7 8 9 10 ; do
  49.         echo "I can count to" $x
  50.     done
  51.  
  52. followed by, in second place:
  53.  
  54.     x=1
  55.     while [ ! "$x" = "11" ] ; do
  56.         echo "I can count to" $x
  57.         : $(( x += 1 ))
  58.     done
  59.  
  60. ...and third place:
  61.  
  62.     ...
  63.     movl    $1, %edx
  64. loop:    pushl    %edx
  65.     movl    $message, %eax
  66.     pushl    %eax
  67.     call    _printf
  68.     inc    %edx
  69.     cmpl    $10, %edx
  70.     jae    loop
  71.     ...
  72. message    .ascii    "I can count to %d\n\0"
  73. -- 
  74.  
  75.